<?php #//AJAX PHP PENNY AUCTION v.1.1

#///////////////////////////////////////////////////////////
#//  COPYRIGHT 2009 Aaron Helmlinger ALL RIGHTS RESERVED  //
#///////////////////////////////////////////////////////////


require('../includes/config.inc.php');
include "loggedin.inc.php";



            




$prefix="../";
#//
$ERR = "";

#//
$query = "SELECT * FROM PHPAUCTIONXL_settings";
$res = @mysql_query($query);
if(!$res) {
	print "Error: $query<BR>".mysql_error();
	exit;
} elseif(mysql_num_rows($res) > 0) {
	$HOME_SETTINGS = mysql_fetch_array($res);
	$SETTINGS=array_merge($SETTINGS,$HOME_SETTINGS);
}
if(file_exists(realpath(phpa_uploaded()."settings.ini"))) {
	$INI_SETTINGS=parse_ini_file(realpath(phpa_uploaded()."settings.ini"));
	$SETTINGS=array_merge($SETTINGS,$INI_SETTINGS);
}

#//
if($_POST['action'] == "update")
{

           $closed_auctions1 = $_POST[closed_auctions];


              $query2="UPDATE PHPAUCTIONXL_version_1_3 SET closed_auctions='$closed_auctions1' WHERE id='1'";
       
mysql_query($query2); 

                 
                 
                 



  if($_FILES['logo']['tmp_name']){
	#// Handle logo upload
	$inf = GetImageSize ($_FILES['logo']['tmp_name']);

   
	if(!empty($_FILES['logo']['tmp_name']) && $_FILES['logo']['tmp_name'] != "none") {
		//		$TARGET = $image_upload_path.$_FILES['logo']['name'];
		$TARGET = realpath(phpa_uploaded())."/".$_FILES['logo']['name'];
		@move_uploaded_file($_FILES['logo']['tmp_name'],$TARGET);
		chmod($TARGET,0666);
		$LOGOUPLOADED = TRUE;
	}
  }

	#// Handle logo upload
	if(!empty($_FILES['background']['tmp_name']) && $_FILES['background']['tmp_name'] != "none") {
		//		$TARGET = $image_upload_path.$_FILES['background']['name'];
		$TARGET = realpath(phpa_uploaded())."/".$_FILES['background']['name'];
		@move_uploaded_file($_FILES['background']['tmp_name'],$TARGET);
		chmod($TARGET,0666);
		$BACKUPLOADED = TRUE;
	}

	$query = " UPDATE PHPAUCTIONXL_settings SET
				   loginbox=".$_POST['loginbox'].",
				   newsbox=".$_POST['newsbox'].",
				   newstoshow=".$_POST['newstoshow'].",";
	$INI_SETTINGS[loginbox]=$_POST['loginbox'];
	$INI_SETTINGS[newsbox]=$_POST['newsbox'];
	$INI_SETTINGS[newstoshow]=$_POST['newstoshow'];
	if($LOGOUPLOADED) {
		$query .= "logo='".$_FILES['logo']['name']."', ";
		$INI_SETTINGS[logo]=$_FILES['logo']['name'];
	}
	if($BACKUPLOADED) {
		$query .= "background='".$_FILES['background']['name']."', ";
		$INI_SETTINGS[background]=$_FILES['background']['name'];
	}
	$query .= "brepeat='".$_POST['brepeat']."',
					featureditemsnumber=".intval($_POST['featureditemsnumber']).",
					featuredcolumns=".intval($_POST['featuredcolumns']).",
					lastitemsnumber=".intval($_POST['lastitemsnumber']).",
					catfeatureditemsnumber=".intval($_POST['catfeatureditemsnumber']).",
					catthumbnailswidth=".intval($_POST['catthumbnailswidth']).",
					higherbidsnumber=".intval($_POST['higherbidsnumber']).",
					endingsoonnumber=".intval($_POST['endingsoonnumber']).",
					thimbnailswidth=".intval($_POST['thimbnailswidth']).",
					pagewidth=".intval($_POST['pagewidth']).",
					pagewidthtype='".$_POST['pagewidthtype']."',
					alignment='".$_POST['alignment']."';";
          
          	
	$INI_SETTINGS[brepeat]=$_POST['brepeat'];
	$INI_SETTINGS[featureditemsnumber]=intval($_POST['featureditemsnumber']);
	$INI_SETTINGS[featuredcolumns]=intval($_POST['featuredcolumns']);
	$INI_SETTINGS[lastitemsnumber]=intval($_POST['lastitemsnumber']);
	$INI_SETTINGS[catfeatureditemsnumber]=intval($_POST['catfeatureditemsnumber']);
	$INI_SETTINGS[catthumbnailswidth]=intval($_POST['catthumbnailswidth']);
	$INI_SETTINGS[higherbidsnumber]=intval($_POST['higherbidsnumber']);
	$INI_SETTINGS[endingsoonnumber]=intval($_POST['endingsoonnumber']);
	$INI_SETTINGS[thimbnailswidth]=intval($_POST['thimbnailswidth']);
	$INI_SETTINGS[pagewidth]=intval($_POST['pagewidth']);
	$INI_SETTINGS[pagewidthtype]=$_POST['pagewidthtype'];
	$INI_SETTINGS[alignment]=$_POST['alignment'];
	$initxt="";
	foreach($INI_SETTINGS as $k=>$v)
	$initxt.="$k=$v\r\n";
	$fp=fopen(realpath(phpa_uploaded())."/"."settings.ini","w");
	fwrite($fp,$initxt);
	fclose($fp);
	$res_ = @mysql_query($query);
	if(!$res_) {
		print "Error: $query<BR>".mysql_error();
		exit;
	} else {
		$SETTINGS=array_merge($SETTINGS,$INI_SETTINGS);
		$ERR = $MSG_5019;
	}
}


$query_settings = "select * from PHPAUCTIONXL_version_1_3 where id='1'";
                             $query_settings2 =  mysql_query ($query_settings);
                                $closed_auctions2 = mysql_result($query_settings2,0,"closed_auctions");
            
      
          
          $query_settings = "select * from PHPAUCTIONXL_version_1_3 where id='1'";
                             $query_settings2 =  mysql_query ($query_settings);
                                $closed_auctions2 = mysql_result($query_settings2,0,"closed_auctions");
           
                                
?>
<html>
<head>
<link rel='stylesheet' type='text/css' href='style.css' />
<link href="css/main.css" rel="stylesheet" type="text/css">
</head>
<bodyleftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="titulo">
                <tr>
                    <td class="icono"><img src="images/graph_icon2.gif" width="30" height="26"></td>
                    <td class="breadcrumbs"><p><span><?=$MSG_25_0009?></span>&nbsp;&gt;&gt;&nbsp;<?=$MSG_5005?></p></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td align="center" valign="middle">&nbsp;</td>
    </tr>
    <tr>
        <td align="center" valign="middle">
            <table border=0 width=100% cellpadding=0 cellspacing=0 bgcolor="#FFFFFF">
                <tr>
                    <td align="center"> <br>
                        
                        
                        
                        
                        <form name=conf action="<?=basename($PHP_SELF)?>" method="POST"  enctype="multipart/form-data">
                        
                        
                            <table width="95%" border="0" cellspacing="0" cellpadding="0" class="base" style="border:1px solid #ccc;">
                                <tr>
                                    <td align=CENTER class=title><p><? print $MSG_5005; ?></p></td>
                                </tr>
                                <tr>
                                    <td>
                                        <table width=100% align="CENTER" cellpadding=0 cellspacing="0">
                                            <?
                                            if($ERR != "") {
											?>
                                            <tr>
                                                <td colspan="2" class="error"><p><? print $ERR; ?> </p></td>
                                            </tr>
                                            <?
                                            }
											?>
                                 
                                 
                                 
                                 <!-- LOGO -->          
                                            <tr valign="TOP">
                                                <td width=125 class="lineV"> <p class="blue "><? print $MSG_531; ?></p> </td>
                                                <td width="393">  <? print $MSG_556; ?> <br>
                                                    <!--<img src="<?="../$uploaded_path".$SETTINGS['logo'];?>">--> <br>
                                                    <img src="<?=phpa_uploaded().$SETTINGS['logo']?>">
                                                     <?=$MSG_602; ?> <br>
                                                    <input type="file" name="logo" size="25" maxlength="100">
                                                    <input type=HIDDEN name="MAX_FILE_SIZE" value="9999999999">
                                                </td>
                                            </tr>
                                   <!-- LOGO --> 
                                   
                                   
                                   
                                            
                                  <!--        
                                          
                                           
                                            <tr valign="TOP">
                                                <td width=125 class="lineV"> 
                                                   <p class="blue"> <?=$MSG_1056?></p>
                                              </td>
                                                <td width="393"> 
                                                    <?=$MSG_1057?>
                                                     <br>
                                                     
                                                    -->
                                                <input type=hidden name=alignment value=left >
                                                                 <!--
                                                    <select name="alignment">
                                                        <option value="left" <?if($SETTINGS['alignment'] == "left") print " SELECTED"?>>Left</option>
                                                        <option value="center" <?if($SETTINGS['alignment'] == "center") print " SELECTED"?>>Center</option>
                                                        <option value="right" <?if($SETTINGS['alignment'] == "right") print " SELECTED"?>>Right</option>
                                                    </select>
                                                </td>
                                            </tr>
                                           
                                            <tr valign="TOP">
                                                <td class="gris lineV"> 
                                                  <p class="blue">  <?=$MGS_2__0051?></p>
                                              </td>
                                                <td class="gris"> 
                                                    <?=$MGS_2__0052?>
                                                     <br>
                                                     -->
                                                    <input name="pagewidth" type="hidden" id="pagewidth" size="5" maxlength="5" value=100 >
&nbsp;                                                 <input type=hidden name=pagewidthtype value=perc >
                                                    
                                                    <!--<select name="pagewidthtype" id="pagewidthtype">
                                                        <option value='perc' <?if($SETTINGS['pagewidthtype'] == 'perc') print " SELECTED";?>>%</option>
                                                        <option value='fix' <?if($SETTINGS['pagewidthtype'] == 'fix') print " SELECTED";?>>
                                                        <?=$MGS_2__0053?>
                                                        </option>
                                                    </select>
                                                </td>
                                            </tr>
                                                   --> 
                                                   
                                                   
                                                  <tr valign="TOP">
                                                <td width=125 class="lineV"> <p class="blue"><? print $MSG_AJAX_ADMIN_GRAPHIC_INTERFACE_LIVE ?></p> </td>
                                                <td width="393"><? print $MSG_AJAX_ADMIN_GRAPHIC_INTERFACE_LIVE_NOTE; ?><br>
                                                    <input type="text" size=5 name=endingsoonnumber value="<?=$SETTINGS['endingsoonnumber']?>"> - <? print $MSG_AJAX_ADMIN_ENTER_ZERO_TO_REMOVE_FROM_HOMEPAGE; ?>
                                                </td>
                                            </tr>   
                                                   
                                            <tr valign="TOP">
                                                <td width=125 class="lineV"> <p class="blue"><? print $MSG_AJAX_ADMIN_GRAPHIC_INTERFACE_UPCOMING; ?></p> </td>
                                                <td width="393"><? print $MSG_AJAX_ADMIN_GRAPHIC_INTERFACE_UPCOMING_NOTE; ?><br>
                                                    <input type="text" size=5 name=lastitemsnumber value="<?=$SETTINGS['lastitemsnumber']?>"> - <? print $MSG_AJAX_ADMIN_ENTER_ZERO_TO_REMOVE_FROM_HOMEPAGE; ?>
                                                </td>
                                            </tr>
                                            
                                            
                                            
                                          <!--
                                            <tr valign="TOP">
                                                <td width=125 class="gris lineV"> <p class="blue"><? print $MSG_5015; ?></p> </td>
                                                <td width="393" class="gris">  <? print $MSG_5016; ?> <br>
                                                  
                                                  -->
                                                    <input type="hidden" size=5 name=higherbidsnumber value="0">
                                                    <!--
                                                </td>
                                            </tr>
                                          --> 
                                          
                                          
                                          
                                                                                   
                                            
                                                          <tr valign="TOP">
                                                <td width=125 class="lineV"> <p class="blue"><? print $MSG_AJAX_ADMIN_GRAPHIC_INTERFACE_CLOSED; ?>
                                                </p> </td>
                                                <td width="393"><? print $MSG_AJAX_ADMIN_GRAPHIC_INTERFACE_CLOSED_NOTE; ?>
                                                    <input type="text" size="5" name="closed_auctions" value="<? print $closed_auctions2; ?>"> - <? print $MSG_AJAX_ADMIN_ENTER_ZERO_TO_REMOVE_FROM_HOMEPAGE; ?>
                                                </td>
                                            </tr>
                                            
                                         <!--    
                                            <tr valign="TOP">
                                                <td width=125 class="gris lineV"> <p class="blue"><? print $MSG_532; ?></p> </td>
                                                <td width="393" class="gris">  <? print $MSG_537; ?> <br>
                                             -->       
                                                    <input type=hidden name=loginbox value=2 >
                                                <!--
					 >
                                                     <? print $MSG_029; ?>  </td>
                                            </tr>
                                            
                                            <tr valign="TOP" class="lineV">
                                                <td width=125 height="61" class="lineV"> <p class="blue"><? print $MSG_533; ?></p> </td>
                                                <td width="393" height="61">  <? print $MSG_538; ?> <br>
                                                   --> 
                                                     <input type=hidden name=newsbox value=2 > 
                                                 
                                                    
                                                    <input type="hidden" name="newstoshow" size="5" maxlength="10" value="1">
                                                    <!--
                                              </td>
                                            </tr>
                                            
                                            
                                             -->
                                            
                                            
                                            
                                            <tr>
                                                <td width=125 class="lineV">
                                                    <input type="hidden" name="action" value="update">
                                                </td>
                                                <td width="393">
                                                    <input type="submit" name="act" value="<? print $MSG_530; ?>" class="action">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width=125></td>
                                                <td width="393"> </td>
                                            </tr>
                                      </table>
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
</body>
</html>
